﻿using System;

namespace SmartSiteManagementSystem.Models.Material
{
    [Serializable]
    public class MaterialCatalogInfo
    {
        #region 数据库对应字段
        private int _catalogId;
        /// <summary>
        /// 物料分类自增Id
        /// </summary>
        public int CatalogId
        {
            set { _catalogId = value; }
            get { return _catalogId; }
        }

        private string _catalogName;
        /// <summary>
        /// 物料分类名
        /// </summary>        
        public string CatalogName
        {
            set { _catalogName = value; }
            get { return _catalogName; }
        }

        private int _parentId;
        /// <summary>
        /// 分类父Id
        /// </summary>
        public int ParentId
        {
            set { _parentId = value; }
            get { return _parentId; }
        }


        private int _sortOrder;
        /// <summary>
        /// 排序Id 约小越靠前
        /// </summary>
        public int SortOrder
        {
            set { _sortOrder = value; }
            get { return _sortOrder; }
        }

        private string _remark;
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark
        {
            get { return _remark; }
            set { _remark = value; }
        }

        private bool _isParent;
        /// <summary>
        /// 是否父分类标识
        /// </summary>
        public bool IsParent
        {
            set { _isParent = value; }
            get { return _isParent; }
        }


        private bool _isStop;
        /// <summary>
        /// 停用标识
        /// </summary>
        public bool IsStop
        {
            set { _isStop = value; }
            get { return _isStop; }
        }



        private bool _isDeleted;
        /// <summary>
        /// 删除标识
        /// </summary>
        public bool IsDeleted
        {
            set { _isDeleted = value; }
            get { return _isDeleted; }
        }

        private DateTime _createtime;
       
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime
        {
            set { _createtime = value; }
            get { return _createtime; }
        }

        private DateTime _updatetime;
        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime UpdateTime
        {
            set { _updatetime = value; }
            get { return _updatetime; }
        }


        #endregion

        #region
        /// <summary>
        /// 顶级分类名称
        /// </summary>
        public string GrandName { get; set; }



        /// <summary>
        /// 上级分类名称
        /// </summary>
        public string ParentName { get; set; }


        private string _superiorName = "";
        public string SuperiorName
        {
            get
            {
                if (!string.IsNullOrEmpty(_superiorName))
                    return _superiorName;

                if (string.IsNullOrEmpty(GrandName) && string.IsNullOrEmpty(ParentName))
                {
                    return _superiorName;
                }
                else if (!string.IsNullOrEmpty(ParentName) && string.IsNullOrEmpty(GrandName))
                {
                    return "一级分类";
                }
                else if (!string.IsNullOrEmpty(ParentName) && !string.IsNullOrEmpty(GrandName))
                {
                    return "二级分类";
                }
                return _superiorName;
            }
            set
            {
                _superiorName = value;
            }
        }

        #endregion

    }
}
